package cn.cjxy.web.servlet.forward;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author huangjie
 * @date 2025/9/26
 */
@WebServlet("/demo2")
public class Demo2 extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String user = (String)req.getAttribute("user");
        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().println("<h1>"+user+"</h1>");
    }
}
